import { Map } from 'immutable'
import * as actionTypes from "./constants"
const defaultState = Map({
    currentSong: {},
    playList: [],
    currentSongIndex: 0,
    order: 0,//0 循环播放 1 随机 2 单曲循环
    lyricList: [],
    lyricing: "加油小兵"
})
function reducer(state = defaultState, action) {
    switch (action.type) {
        case actionTypes.CHANGE_CURRENT_SONG:
            return state.set("currentSong", action.currentSong)
        case actionTypes.CHANGE_PLAY_LIST:
            return state.set("playList", action.playList)
        case actionTypes.CHANGE_CURRENT_SONG_INDEX:
            return state.set("currentSongIndex", action.currentSongIndex)
        case actionTypes.CHNAGE_ORDER:
            return state.set("order", action.order)
        case actionTypes.CHANGE_LYRIC_LIST:
            return state.set("lyricList", action.lyricList)
        case actionTypes.CHANGE_LYRICING:
            return state.set("lyricing", action.lyricing)
        default:
            return state
    }
}
export default reducer